//
// Created by LiuYou on 2021/10/12.
//

#include <iostream>
#include "Counter.hpp"


// todo 笔记根据多次运行得出的结论:
//  全局对象的创建所在的线程也是 main线程。
Counter aCounter;


void* aThread(void* args) {
    aCounter.getAndIncrease();

    Counter counter;

    pthread_exit( nullptr );
}


int main(int argc, char** argv) {
    std::cout << "main线程的tid [ " << pthread_self() << " ]。" << std::endl;

    Counter counter;

    pthread_t tid;
    pthread_create( &tid, nullptr, aThread, nullptr );

    pthread_join( tid, nullptr );


    return 0;
}
